<div class="panel panel-default panel-intro">
    <div class="panel-heading">
        <h3 class="panel-title">质检记录详情</h3>
    </div>
    <div class="panel-body">
        <div class="panel panel-info">
            <div class="panel-heading">
                <h4 class="panel-title">报工信息</h4>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">小工单计划编码:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.report.allocation.plan.plan_code|default='--'}</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">订单名称:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.report.allocation.order.order_name|default='--'}</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">工序:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.report.allocation.process.name|default='--'}</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">产品型号:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.report.allocation.model.name|default='--'}</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">报工数量:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.report.quantity|default='--'}</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">报工员:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.report.user.nickname|default=$row.report.user.username|default='--'}</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">报工备注:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.report.remark|default='--'}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="panel panel-primary">
            <div class="panel-heading">
                <h4 class="panel-title">质检信息</h4>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">质检标准:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.standard.name|default='--'}</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">质检员:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.qualityUser.nickname|default=$row.qualityUser.username|default='--'}</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">质检结果:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">
                                    {if $row.overall_result == 1}
                                        <span class="label label-success">合格</span>
                                    {elseif $row.overall_result == 2}
                                        <span class="label label-danger">不合格</span>
                                    {elseif $row.overall_result == 3}
                                        <span class="label label-warning">让步接收</span>
                                    {else}
                                        --
                                    {/if}
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">处理方式:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">
                                    {if $row.handle_method == 1}
                                        返工
                                    {elseif $row.handle_method == 2}
                                        报废
                                    {elseif $row.handle_method == 3}
                                        让步接收
                                    {else}
                                        --
                                    {/if}
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">检验时间:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.check_time|date='Y-m-d H:i:s',###}</p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label col-sm-4">质检备注:</label>
                            <div class="col-sm-8">
                                <p class="form-control-static">{$row.remark|default='--'}</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="panel panel-success">
            <div class="panel-heading">
                <h4 class="panel-title">检查结果</h4>
            </div>
            <div class="panel-body">
                {if $row.check_results_array}
                <div id="check-results-container" data-results='{:json_encode($row.check_results_array)}'>
                    <!-- 检查结果将通过JavaScript动态生成 -->
                </div>
                {else}
                <p class="text-muted">暂无检查结果数据</p>
                {/if}
            </div>
        </div>

        {if $row.unqualified_items_array}
        <div class="panel panel-warning">
            <div class="panel-heading">
                <h4 class="panel-title">不合格项目</h4>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>项目</th>
                                <th>问题</th>
                                <th>严重程度</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $row.unqualified_items_array as $item}
                            <tr>
                                <td>{$item.项目}</td>
                                <td>{$item.问题}</td>
                                <td>
                                    {if $item.严重程度 == '严重'}
                                        <span class="label label-danger">严重</span>
                                    {elseif $item.严重程度 == '中等'}
                                        <span class="label label-warning">中等</span>
                                    {elseif $item.严重程度 == '轻微'}
                                        <span class="label label-info">轻微</span>
                                    {else}
                                        {$item.严重程度}
                                    {/if}
                                </td>
                            </tr>
                            {/foreach}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        {/if}

        <div class="form-group layer-footer">
            <div class="col-sm-12 text-center">
                <button type="button" class="btn btn-default btn-embossed" onclick="history.back()">返回</button>
            </div>
        </div>
    </div>
</div>
